package com.example.demo.controller.discuss.comment;

import com.example.demo.dto.ResponseDto;
import com.example.demo.param.ComentParam;
import com.example.demo.param.CommunicationParam;
import com.example.demo.service.CommentService;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * TODO
 * 评论模块
 * @author mazh47622
 * @date2024/2/4
 * @modify -----------------------------------------------------------------------------------------------------
 * |修改单号|修改人员|修改日期|评审人员|修改说明
 * -----------------------------------------------------------------------------------------------------
 * |      |       |      |       |
 * -----------------------------------------------------------------------------------------------------
 */
@RequestMapping("/comment")
@RestController
public class CommentController {

    @Resource
    private CommentService commentService;


    /**
     * 评论
     * @param comentParam
     * @return
     */
    @PostMapping("/createCommunication")
    ResponseDto createComment(@RequestBody ComentParam comentParam){
        commentService.createComment(comentParam);
        return new ResponseDto<>().buildSucceedHasData(true);
    }

    /**
     * 查询帖子
     * @param comentParam
     * @return
     */
    @PostMapping("/queryComentList")
    ResponseDto queryComentList(@RequestBody ComentParam comentParam){
        return new ResponseDto<>().buildSucceedHasData(commentService.queryComentList(comentParam));
    }


    /**
     * 删除帖子
     */
    @PostMapping("/deleteComent")
    ResponseDto deleteComent(@RequestBody ComentParam comentParam){
        commentService.deleteComent(comentParam);
        return new ResponseDto<>().buildSucceedHasData(true);
    }
}
